<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@page import="Kontroller.Oversikt, Problemdomeneklasser.Sporsmaal" %>

    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script src="resources/js/jquery.min.js"></script>
        <script src="resources/js/jquery.jqplot.min.js"></script>
        <script src="resources/js/jqplot.barRenderer.min.js"></script>
        <script src="resources/js/jqplot.categoryAxisRenderer.min.js"></script>
        <script src="resources/js/jqplot.pointLabels.min.js"></script>
        <link   href="resources/css/jquery.jqplot.min.css" rel="stylesheet" type="text/css" />
    </head>

        <form id="form2">           
            <figure id="chart2"></figure>
        </form>
        <script>
            <%
                String sLenke = request.getParameter("sLenke");
                Oversikt ov = new Oversikt();
                Sporsmaal spm = ov.hentSporsmaalURL(sLenke);
            %> 
                    var spm = <%=spm.toJavaScript()%>;
                    $('#spm').append(spm.tekst);
                    var s1 = new Array();
                    var ticks = new Array();
                    var b = spm.altArray;
                    for(var i=0;i<b.length;i++){
                        s1[i] = b[i].antall_valgt;
                        ticks[i] = b[i].navn+") "+b[i].tekst;
                    }                    
                    $.jqplot.config.enablePlugins = true;
                    plot1 = $.jqplot('chart2', [s1], {
                        // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
                        animate: !$.jqplot.use_excanvas,
                        seriesDefaults:{
                            renderer:$.jqplot.BarRenderer,
                            pointLabels: { show: true }
                        },
                        axes: {
                            xaxis: {
                                renderer: $.jqplot.CategoryAxisRenderer,
                                ticks: ticks
                            }
                        },
                        highlighter: { show: false }
                    });
               
        </script>

